from django.conf.urls import url
from . import views
from rest_framework_jwt.views import obtain_jwt_token
from rest_framework import routers

urlpatterns = [
    # 注册
    url(r'^users/$', views.UserView.as_view()),
    # 校验手机号
    url(r'^mobiles/(?P<mobile>1[3-9]\d{9})/count/$', views.MobileCountView.as_view()),
    # 校验用户名
    url(r'^usernames/(?P<username>\w{5,20})/count/$', views.UserNameCountView.as_view()),
    # JWT提供了签发JWT的视图,但是该视图只返回token
    # url(r'^authorizations/$', obtain_jwt_token),# 这个视图已经过期，不能满足我们在登陆时合并购物车的操作
    url(r'^authorizations/$', views.UserAuthorizeView.as_view()),
    url(r'^user/$', views.UserDetailView.as_view()),  # 个人中心
    url(r'^email/$', views.EmailView.as_view()),  # 设置邮箱
    url(r'^browse_histories/$', views.UserBrowsingHistoryView.as_view()), # 历史浏览记录
    url(r'^emails/verification/$', views.VerifyEmailView.as_view()),  # 验证邮箱


]

router = routers.DefaultRouter()
router.register(r'addresses', views.AddressViewSet, base_name='addresses')

urlpatterns += router.urls
